<template>
  <div class="home_container">
    <div class="banner">
      <!-- 轮播图 -->
      <div class="swiper-container">
        <van-swipe :autoplay="3000">
          <van-swipe-item v-for="(image, index) in pointImgList" :key="index">
            <img v-lazy="`http://liufusong.top:8080${image.imgSrc}`" />
          </van-swipe-item>
        </van-swipe>
      </div>
      <!-- 搜索框 -->
      <div class="header">
        <common-search :city="city"></common-search>
      </div>
    </div>
    <div class="Main">
      <div class="MainList">
        <ul class="father">
          <li>
            <van-icon name="wap-home-o" />
            <p>整租</p>
          </li>
          <li>
            <van-icon name="friends-o" />
            <p>合租</p>
          </li>
          <li>
            <van-icon name="location-o" />
            <p>地图找房</p>
          </li>
          <li class="last" @click='clickToRent'>
            <van-icon name="shop-collect-o" />
            <p>去出租</p>
          </li>
        </ul>
      </div>
      <div class="rentCount">
        <h4>租房小组</h4>
        <p class="more">更多</p>
      </div>
      <div class="rentphoto">
        <div class="homePhoto" v-for="item in list" :key='item'>
          <div>
            <!-- <img :src="item.imgSrc" alt=""> -->
             <img class='rentcountimg' :src="`http://liufusong.top:8080${item.imgSrc}`" alt="">
          </div>
          <div class="smolltitle1">
            <p>{{item.title}}</p>
            <p>{{item.desc}}</p>
          </div>

        </div>
      </div>
      <div class='content'>
      </div>
    </div>
  </div>
</template>

<script>
import CommonSearch from '@/components/CommonSearch.vue'
import { getSwiper, getHouseGroup } from '@/api/favorites'
export default {
  components: { CommonSearch },
  data () {
    return {
      value: '',
      city: '上海',
      rentType: [
        { name: '整租', icon: 'house', path: '/find' },
        { name: '合租', icon: 'usergroup', path: '/find' },
        { name: '地图找房', icon: 'map', path: '/map' },
        { name: '去出租', icon: 'house2', path: '/add' }
      ],
      pointImgList: [],
      list: []
    }
  },
  async created () {
    const res = await getSwiper()

    this.pointImgList = res.body

    // 租房小组接口
    const reg = await getHouseGroup(this.id)
    console.log(reg)
    this.list = reg.body
  },
  methods: {

    clickToRent () {
      this.$router.push('/ToRent')
    }
  }
}
</script>
<style lang="less" scoped>
.home_container {
  height: 80%;
  background-color: #f6f5f6;
  .banner {
    margin-bottom: 5px;
    position: inherit;
    height: 215px;
    overflow: hidden;
    img {
      width: 100%;
      height: 100%;
    }
    .header {
      display: flex;
      position: absolute;
      top: 25px;
      padding: 0 15px;
      width: 100%;
      height: 35px;
      z-index: 1000;
      margin-left: 10px;
    }
  }
  .Main {
    min-height: 400px;
    .MainList {
      height: 90px;
      margin-bottom: 5px;
    }
    .father {
      min-height: 30px;
      display: flex;
      background-color: #fff;
      .van-icon {
        color: #21b97a;
        font-size: 40px;
        justify-content: center;
        align-items: center;
        // margin: 26px;
        margin-top: 10px;
        margin-left: 10px;
        margin-bottom: 10px;
      }
    }
    p {
      margin-top: 0;
      margin-bottom: 0;
      text-align: center;
      width: 80px;
      margin-left: -10px;
    }
    ul {
      height: 100px;
      display: flex;
      justify-content: space-between;
      align-content: center;
      margin-bottom: 5px;
    }
    li {
      list-style: none;
      background-color: #c2ecda;
      width: 60px;
      height: 60px;
      border-radius: 50%;
      margin-left: 20px;
      margin-top: 10px;
    }
    .last {
      margin-right: 20px;
    }
  }
  .more {
    display: inline-block;
  }
  .rentCount {
    height: 50px;
    // background-color: pink;
    display: flex;
    justify-content: space-between;
    align-content: center;
    margin-bottom: 10px;
    p {
      line-height: 50px;
    }
    h4 {
      margin-top: 10px;
    }
  }
  .rentphoto {
    height: 150px;
    margin-top: 10px;
    // background-color: skyblue;
    .homePhoto{
      display: flex;
      position: relative;
      float: left;
      background-color: #fff;
 height: 60px;
      width: 160px;
      // background-color: cadetblue;
      // margin-top: -18px;
      margin: -18px 5px 10px 10px;
          margin-bottom: 30px;
      .rentimg{
      width: 50px;
      height: 50px;
      position: absolute;
    }
    p{
margin-left: 10px;
    }
    }

  }
}
.rentcountimg{
  width: 50px;
  height: 50px;
}
.content{
  height: 100px;
  background-color: #fff;
}
</style>
